Hi, I'm facing a issue when loading an include file that contains that kind of perms (It is awful but useful in my context to avoid string table expansion ;-) ):
void intLogTrain(string m1, m2, m3, m4, m5, m6, m7, m8, m9, m10) {
//bla bla
}
void intLogTrain(string m1, m2, m3, m4, m5, m6, m7, m8, m9) {
intLogTrain(m1, m2, m3, m4, m5, m6, m7, m8, m9, null)
}
void intLogTrain(string m1, m2, m3, m4, m5, m6, m7, m8) {
intLogTrain(m1, m2, m3, m4, m5, m6, m7, m8, null, null)
}
void intLogTrain(string m1, m2, m3, m4, m5, m6, m7) {
intLogTrain(m1, m2, m3, m4, m5, m6, m7, null, null, null)
}
void intLogTrain(string m1, m2, m3, m4, m5, m6) {
intLogTrain(m1, m2, m3, m4, m5, m6, null, null, null, null)
}
void intLogTrain(string m1, m2, m3, m4, m5) {
intLogTrain(m1, m2, m3, m4, m5, null, null, null, null, null)
}
void intLogTrain(string m1, m2, m3, m4) {
intLogTrain(m1, m2, m3, m4, null, null, null, null, null, null)
}
void intLogTrain(string m1, m2, m3) {
intLogTrain(m1, m2, m3, null, null, null, null, null, null, null)
}
void intLogTrain(string m1, m2) {
intLogTrain(m1, m2, null, null, null, null, null, null, null, null)
}
If I keep only the first perm the include loading is quite immediate, If I keep all perms lasts very longer (actually 1 sec approx for this example) !!!! Does it sound familiar to someone ? An explanation may be ? Another way to proceed ? (for example perm with variable number of parameters...) Thanks for help. Regards. Joseph jaracic - Wed Oct 12 10:31:54 EDT 2016 |
Re: include loading process explanation needed Yes that sounds very familiar. The parser gets incredibly slow when you declare a lot of functions with the same name. I once declared a "toString" function for all types in DXL. Parsing times of the DXL went up to 10 seconds. This is a parser problem, you can only get around it by declaring the functions with different names. I resorted to declaring them (toString_Skip, toString_Module, etc.). Regards, Mathias |
Re: include loading process explanation needed By the way: I would be interested to know why you think the above construct will help you with string table expansion. I am sure there is a much slicker way to accomplish what you want (using operators and structs). Regards, Mathias |
Re: include loading process explanation needed Mathias Mamsch - Thu Oct 13 03:32:37 EDT 2016 By the way: I would be interested to know why you think the above construct will help you with string table expansion. I am sure there is a much slicker way to accomplish what you want (using operators and structs). Regards, Mathias I did that because of legacy code... Previously it was only one perm with only one string parameter. It means that in the code al lot of strings concatenation has been made to define the log message. I did something to avoid as much as possible string concatenations... without refactoring the legacy too much.
I don't use to define operators, but yes it seems to be a possible solution to avoid this declarations constructions. Anyway do you know why it takes so long to load dxl that contains these kind of declaration ? kind regards. |
Re: include loading process explanation needed jaracic - Thu Oct 13 05:39:43 EDT 2016 I did that because of legacy code... Previously it was only one perm with only one string parameter. It means that in the code al lot of strings concatenation has been made to define the log message. I did something to avoid as much as possible string concatenations... without refactoring the legacy too much.
I don't use to define operators, but yes it seems to be a possible solution to avoid this declarations constructions. Anyway do you know why it takes so long to load dxl that contains these kind of declaration ? kind regards. As I said. It is a problem with the parser and you will probably not get around it. |
Re: include loading process explanation needed
Hey ! Here after an example of the use of such argument ...
int add(int vals[]){
int i; int rez=0; int n=sizeof vals;
for i in 0:n-1 do { rez = rez + vals[i] }
return rez
}
print add(1,2,3) "\n"
print add(1,2,3,4,5,6,7) "\n"
And yes ... you can add defensive code to deal with the call without attribute o;) |
Re: include loading process explanation needed pommCannelle - Thu Oct 13 08:33:04 EDT 2016
Hey ! Here after an example of the use of such argument ...
int add(int vals[]){
int i; int rez=0; int n=sizeof vals;
for i in 0:n-1 do { rez = rez + vals[i] }
return rez
}
print add(1,2,3) "\n"
print add(1,2,3,4,5,6,7) "\n"
And yes ... you can add defensive code to deal with the call without attribute o;) Of course array parameters !! ;-)
|
Re: include loading process explanation needed jaracic - Thu Oct 13 09:16:07 EDT 2016 Of course array parameters !! ;-)
It' s not a joke !
void left( DBE x, DBE y ){ x->"top"->"aligned"->y; x->"left"->"spaced"->y }
void line( DBE x[] ){ int n = sizeof x; int i; for i in 1:n-1 do left ( x[i], x[i-1] ) }
Et voilĂ ! |
Re: include loading process explanation needed pommCannelle - Thu Oct 13 09:29:54 EDT 2016
It' s not a joke !
void left( DBE x, DBE y ){ x->"top"->"aligned"->y; x->"left"->"spaced"->y }
void line( DBE x[] ){ int n = sizeof x; int i; for i in 1:n-1 do left ( x[i], x[i-1] ) }
Et voilĂ ! I knew it wasn't ;-) Actually I'm a former Lisp programmer (for a while now..), and clearly I forget all my basic functional programming techniques. Actually I don't code anymore for a while (except when deploying DOORS...grrr) Thanks. Joseph |